/*
 * OPIAM Suite
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

package opiam.admin.faare.service.services.acl;

import opiam.admin.faare.config.javabeans.JBAcls;
import opiam.admin.faare.exception.ServiceException;
import opiam.admin.faare.persistence.javabeans.JBTop;
import opiam.admin.faare.service.UserContext;


/**
 * This ACLs plugin is a plugin that does not any controls, it allows all the
 * operations to all the users.
 */
public class NoControlAclPlugin implements AclPluginInterface
{
    /**
     * This method is called by the PropertiesManager at the initialization.
     *
     * @see opiam.admin.faare.service.services.acl.AclPluginInterface#initialize(JBAcls).
     */
    @Override
	public void initialize(JBAcls acls)
    {
    }

    /**
     * This method is called to verify if the given object in argument can be
     * created by the user which the context is given in argument.
     * The given object is an LDAP Directory entry.
     *
     * @param entry        The object to create.
     * @param userContext  Context of the user.
     *
     * @return True if the creation is allowed, false otherwise.
     *
     * @see opiam.admin.faare.service.services.acl.AclPluginInterface#isCreationEnabled(JBTop, UserContext).
     *
     * @throws ServiceException  if an error occurs.
     */
    @Override
	public boolean isCreationEnabled(JBTop entry, UserContext userContext)
        throws ServiceException
    {
        return true;
    }

    /**
     * This method is called to verify if the given object in argument can be
     * deleted by the user which the context is given in argument.
     * The given object is an LDAP Directory entry.
     *
     * @param entry  The object to delete.
     * @param userContext  Conetct of the user.
     *
     * @return True if the deletion is allowed, false otherwise.
     *
     * @see opiam.admin.faare.service.services.acl.AclPluginInterface#isDeletionEnabled(JBTop, UserContext).
     *
     * @throws ServiceException  if an error occurs.
     */
    @Override
	public boolean isDeletionEnabled(JBTop entry, UserContext userContext)
        throws ServiceException
    {
        return true;
    }

    /**
     * This method is called to verify if the first given object in argument can be
     * modified by the user which the context is given in argument.
     * The given objects are LDAP Directory entries.
     *
     * @param oldentry  The entry before modification.
     * @param newentry  The entry after modification.
     * @param userContext The context of the user.
     *
     * @return True if the modification is allowed, false otherwise.
     *
     * @see opiam.admin.faare.service.services.acl.AclPluginInterface#isModificationEnabled
     *   (JBTop, JBTop, UserContext).
     *
     * @throws ServiceException  if an error occurs.
     */
    @Override
	public boolean isModificationEnabled(JBTop oldentry, JBTop newentry,
        UserContext userContext) throws ServiceException
    {
        return true;
    }

    /**
     * This method is called to verify if the given object in argument can be
     * viewed by the user which the context is given in argument.
     * The given object is an LDAP Directory entry.
     *
     * @param entry  The object to view.
     * @param userContext  Context of the user.
     *
     * @return True if the visualisation is allowed, false otherwise.
     *
     * @see opiam.admin.faare.service.services.acl.AclPluginInterface#isVisualisationEnabled(JBTop, UserContext).
     *
     * @throws ServiceException  if an error occurs.
     */
    @Override
	public boolean isVisualisationEnabled(JBTop entry, UserContext userContext)
        throws ServiceException
    {
        return true;
    }
}
